<template>
  <BasicModal v-bind="$attrs" @register="registerModal" title="邀请链接详情" destroyOnClose width="550px">
    <Description :column="1" :data="detailData" @register="registerDescription" />
  </BasicModal>
</template>
<script lang="ts" setup>
  import { ref, useAttrs } from "vue"
  import { BasicModal, useModalInner } from "/@/components/Modal"
  import { inviteUserDetailSchema } from "../data"
  import * as userApi from '/@/api/iam/user'
  import { Description, useDescription } from "/@/components/Description/index"
  const emit = defineEmits(["register"])
  const attrs = useAttrs()
  const detailData = ref({})
  const [registerDescription] = useDescription({
    schema: inviteUserDetailSchema,
    labelStyle: {
      marginLeft: "10px",
      width: "100px",
    },
  })

  const [registerModal, { setModalProps }] = useModalInner(async (data) => {
    setModalProps({ showOkBtn: false, showCancelBtn: false, loading: true })
    try {
      detailData.value = await userApi.getUserInvite({ id: data.record.id })
    } finally {
      setModalProps({ loading: false })
    }
    
  })
</script>
